import tkinter as tk
import tkinter.messagebox as tkMsgbox
top = tk.Tk()
frame1 = tk.Frame(top)
frame1.pack()
label1 = tk.Label(frame1,text = '请输入正确的幻和')
label1.pack(side = tk.LEFT)
s = tk.IntVar()
sinput = tk.Entry(frame1, textvariable=s)
sinput.pack(side = tk.LEFT)
frame2 = tk.Frame(top)
frame2.pack()
label2 = tk.Label(frame2,text = '          ')
label2.pack()
g = 0
def conf():
    global label2,g
    g = int(sinput.get())
    if g >= 15 and g % 3 == 0:
        label2.configure(text = '您输入的幻和是正确的')
        tkMsgbox.showinfo('AW',str('中心数为'+str(g // 3)))
        return 
    else:
        label2.configure(text = '您输入的幻和是错误的')
frame3 = tk.Frame(top)
frame3.pack()
button = tk.Button(text = 'OK',command = conf)
button.pack()
tk.mainloop()
'''
证明：
    设9个数字分别为a1,a2,a3,a4,a5,a6,a7,a8,a9
    [[a1,a2,a3],
     [a4,a5,a6],
     [a7,a8,a9]]
    (a1+a5+a9) + (a2+a5+a8) + (a3,a5,a7) == a1+a2+a3+a4+a5+a6+a7+a8+a9
    a5+a5+a5 == a5+a6+a7
    3 * a5 == 幻和
    a5 == 1/3幻和
'''